package com.example.onlinemusic.controller;

import com.example.onlinemusic.model.User;
import com.example.onlinemusic.tools.ResponseBodyMessage;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * \* Created with IntelliJ IDEA.
 * \* User: Administrator
 * \* Date: 2022/7/29
 * \* Time: 15:14
 * \* To change this template use File | Settings | File Templates.
 * \* Description:
 * \
 */
@RestController
@RequestMapping("/hhh")
public class TestController {

    @RequestMapping("/test")
    public ResponseBodyMessage<User> login(@RequestParam String username,
                                           @RequestParam String password){
        System.out.println("username:"+username);
        System.out.println("password:"+password);
        User user = new User();
        if(username.equals("zhu") && password.equals("123456")){
            user.setPassword(password);
            return new ResponseBodyMessage<>(0,"登录成功",user);
        }else {
            return new ResponseBodyMessage<>(-1,"登录失败",null);
        }
    }
}
